<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryRef"
      :inline="true"
      v-show="showSearch"
    >
      <el-form-item label="" prop="date">
        <!-- 选择日期 -->
        <el-date-picker
          v-model="queryParams.date"
          type="date"
          placeholder="请选择日期"
          value-format="YYYY-MM-DD"
          style="width: 200px"
        />
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          @click="handleExport"
          v-hasPermi="['system:contract:transactionType:add']"
          >导出</el-button
        >
      </el-col>
      <right-toolbar
        v-model:showSearch="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row> -->
    <div>
      <el-row :gutter="10">
        <el-col :span="24" style="margin-bottom: 10px">
          <el-card>
            <template #header>华中置业公司经营日报表（店面）</template>
            <div>
              <el-descriptions :column="2" border>
                <el-descriptions-item label="本日收款总额">{{
                  dataList.sumReceivePaymentPrice
                }}</el-descriptions-item>
                <el-descriptions-item label="本日付款总额（-）">{{
                  dataList.sumPaymentPrice
                }}</el-descriptions-item>
                <el-descriptions-item label="本日现金余额">{{
                  dataList.sumDayBalance
                }}</el-descriptions-item>
                <el-descriptions-item label="现金累计总额">{{
                  dataList.sumTotal
                }}</el-descriptions-item>
                <el-descriptions-item
                  v-for="item in dataList.paymentList"
                  :key="item.id"
                  :label="item.typeName"
                  >{{ item.sumPaymentPrice }}</el-descriptions-item
                >
              </el-descriptions>
            </div>
          </el-card>
        </el-col>
        <el-col :span="24">
          <el-card>
            <template #header>华中置业公司经营日报表（公司）</template>
            <div>
              <el-descriptions :column="2" border>
                <el-descriptions-item label="本日收款总额">{{
                  companyList.sumReceivePaymentPrice
                }}</el-descriptions-item>
                <el-descriptions-item label="本日付款总额（-）">{{
                  companyList.sumPaymentPrice
                }}</el-descriptions-item>
                <el-descriptions-item label="本日现金余额">{{
                  companyList.sumDayBalance
                }}</el-descriptions-item>
                <el-descriptions-item label="现金累计总额">{{
                  companyList.sumTotal
                }}</el-descriptions-item>
                <el-descriptions-item
                  v-for="item in companyList.paymentList"
                  :key="item.id"
                  :label="item.typeName"
                  >{{ item.sumPaymentPrice }}</el-descriptions-item
                >
              </el-descriptions>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>

    <!-- 添加或修改岗位对话框 -->
    <el-dialog :title="title" v-model="open" width="1000px" append-to-body>
      <div></div>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="OperateReport">
import {
  storeDaily,
  getCompanyDaily,
} from "@/api/dailyNewspaper/operateReport";
const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
import { reactive } from "vue";
const dataList = ref({});
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
  queryParams: {},
  rules: {},
});

const { queryParams, rules } = toRefs(data);
const form = ref({});

/** 查询岗位列表 */
function getList() {
  loading.value = true;
  storeDaily(queryParams.value).then((response) => {
    dataList.value = response.data;
    loading.value = false;
  });
}
const companyList = ref({});
function getCompanyList() {
  getCompanyDaily(queryParams.value).then((response) => {
    companyList.value = response.data;
    loading.value = false;
  });
}
getCompanyList();
/** 取消按钮 */
function cancel() {
  open.value = false;
  reset();
}

/** 表单重置 */
function reset() {
  form.value = {};
  proxy.resetForm("postRef");
}

/** 搜索按钮操作 */
function handleQuery() {
  getList();
  getCompanyList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
}

getList();
</script>
<style scoped>
.buyer-payment-form {
  font-family: SimSun, serif;
  padding: 20px;
  font-size: 14px;
  background: #fff;
  width: 900px;
  margin: 0 auto;
  border: 1px solid #000;
}
.title {
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 20px;
}
.table {
  display: table;
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}
.table-row {
  display: table-row;
}
.cell {
  display: table-cell;
  border: 1px solid #000;
  padding: 6px 10px;
  vertical-align: middle;
  min-height: 30px;
}
.header {
  background: #f0f0f0;
  font-weight: bold;
  text-align: center;
}
.input {
  padding: 4px 6px;
}
.label {
  background: #f9f9f9;
  font-weight: bold;
  width: 140px;
}
.readonly {
  background: #f9f9f9;
  text-align: center;
}
.subtotal {
  font-weight: bold;
  background: #f4f8ff;
  text-align: left;
}
.total-table .total {
  font-weight: bold;
  background: #e1f3ff;
  text-align: center;
}
.group-table {
  margin-top: 10px;
}
</style>
